#include <vector>
#include "Polygon.h"


using std::vector;


/*vector<Triangle*> Polygon::Triangulate()
{
}
*/

void Polygon::Transform(const Matrix4 & matrix)
{
	for (size_t i = 0; i < _dots.size(); i++)
	{
		_dots[i] *= matrix;
	}
	for (size_t i = 0; i < _normals.size(); i++)
	{
		_normals[i] *= matrix;
	}
}

void PolygonBuilder::Begin()
{
	_polygon.reset(new Polygon);
}

void PolygonBuilder::AddPoint(const Vector3 &coord, const Vector3 &normal, const TexCoords &tex)
{
	_polygon->_dots.push_back(coord);
	_polygon->_normals.push_back(normal);
	_polygon->_texCoords.push_back(tex);
}

Polygon* PolygonBuilder::Grab()
{
	return _polygon.release();
}
